﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using eschoolBO;

namespace ESCHOOL.teachers
{
    public partial class WebForm8 : System.Web.UI.Page
    {
        student_feedback sf = new student_feedback();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = sf.GetRecords(-99, -99, Convert.ToInt64(Session["userid"]), "", false, " and ");
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }

        protected void btndelete_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                DataTable dt = sf.GetRecords(Convert.ToInt64(e.CommandArgument), -99, Convert.ToInt64(Session["userid"]), "", false, " and ");
                sf.sfeedback_id = Convert.ToInt64(dt.Rows[0]["sfeedback_id"].ToString());
                sf.teacher_id = Convert.ToInt64(dt.Rows[0]["teacher_id"].ToString());
                sf.student_id = Convert.ToInt64(dt.Rows[0]["student_id"].ToString());
                sf.feedback = dt.Rows[0]["feedback"].ToString();
                sf.isdeleted = true;
                sf.SaveRecords();
                Response.Redirect("~/teachers/TSFeedback.aspx");
            }
        }

        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {

        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            DataTable dt = sf.GetRecords(-99, -99, Convert.ToInt64(Session["userid"]), "", false, " and ");
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
    }
}
